package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.pojo.domain.Clazz;
import com.itheima.pojo.dto.ClazzPageQueryDTO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClazzMapper {
    @Insert("insert into clazz(name,room,begin_date,end_date,master_id,subject,create_time,update_time) values(#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
    void addClazzInfo(Clazz clazz);


    Page<Clazz> sleInfoByPage(ClazzPageQueryDTO clazzPageQueryDTO);


    void update(Clazz clazz);

    @Select("select c.*,e.name as master_name from clazz c left join tlias.emp e on c.master_id = e.id ")
    List<Clazz> listAll();

    @Select("select * from clazz where id=#{id}")
    Clazz getClazzInfoById(Integer id);

    @Delete("delete  from clazz where id=#{id}")
    void deleteClazz(Integer id);
}
